﻿using Business.HouseManagement;
using Business.HouseManagement.Dto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace Business.Controllers
{
    [RemoteService]
    [Area("Business")]
    [Route("api/business/house")]
    public class HouseController: AbpController
    {
        private readonly IHouseAppService _houseAppService;

        public HouseController(IHouseAppService houseAppService)
        {
            _houseAppService=houseAppService;
        }

        /// <summary>
        /// 创建或更新仓库信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        [Route("data-post")]
        public Task<HouseDto> CreateOrUpdate(CreateOrUpdateHouseDto input)
        {
           return _houseAppService.CreateOrUpdate(input);
        }
        /// <summary>
        /// 删除仓库信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("delete")]
        public Task Delete(List<Guid> ids)
        {
            return _houseAppService.Delete(ids);
        }

        /// <summary>
        /// 获取仓库信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        [Route("{id}")]
        public Task<HouseDto> Get(Guid id)
        {
            return _houseAppService.Get(id);
        }
        /// <summary>
        /// 获取仓库列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public Task<PagedResultDto<HouseDto>> GetAll(GetBookInputDto input)
        {
            return _houseAppService.GetAll(input);
        }
    }
}
